<template>
	<view class="layout">
		<view class="scrollView" v-for="item in wordsList" :key="item.number">
			<view class="item">
				<text>{{ item.word }}</text>
				<text>{{ item.symbol }}</text>
				<text>{{ item.meaning }}</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app';
	import { ref } from "vue";
	
	let wordsList = ref([]);
	
	onLoad((e) => {
		let arr = JSON.parse(decodeURIComponent(e.arr))
		// let arr = [2,4,5]
		let wordBank = uni.getStorageSync(e.wordBankId)
		// let wordBank = uni.getStorageSync("GaoKao3500-1")
		//根据number从词库中赛选单词
		arr.forEach((item) => {
		    wordsList.value.push(wordBank.find(word => word.number === item))
		})
		
	})
</script>

<style lang="scss" scoped>
	.layout{
		padding: 30rpx;
		.scrollView{
			.item{
				margin-bottom: 30rpx;
				padding: 20rpx;
				display: flex;
				flex-direction: column;
				gap: 15rpx;
				background-color: white;
			}
		}
	}
</style>
